//
//  WebViewController.m
//  GetPowerDBO
//
//  Created by 周博 on 2017/6/27.
//  Copyright © 2017年 BogoZhou. All rights reserved.
//

#import "WebViewController.h"
#import <WebKit/WebKit.h>


@interface WebViewController ()
{
    
}
@property (nonatomic,strong) WKWebView *webView;
@end

@implementation WebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self UISetting];
    [self wkWebViewEasyUse];
}

- (IBAction)backButtonClick:(UIButton *)sender {
//    if (_webView.canGoBack) {
//        [_webView goBack];
//    }else{
        [self.navigationController popViewControllerAnimated:YES];
//    }
}


- (void)wkWebViewEasyUse
{
    //1.创建WKWebView
    CGFloat width = self.view.frame.size.width;
    CGFloat height = self.view.frame.size.height - 64;
    _webView = [[WKWebView alloc] initWithFrame:CGRectMake(0,64,width,height)];
    //2.创建URL
    NSURL *URL = [NSURL URLWithString:_urlString];
    //3.创建Request
    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
    //4.加载Request
    [_webView loadRequest:request];
    //5.添加到视图
    [self.view addSubview:_webView];
}

- (void)UISetting{
    _labelTitle.text = _titleString;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
